using System;
using System.Collections.Generic;
using Dict.DataModel;

namespace Dict.Dao
{
    public class TableUnionFightCariotDao:DaoBase<TableUnionFightCariot>
    {
        public override void AddPrimaryIndex(TableUnionFightCariot model)
        {
            cachePrimary[model.UFCId.ToString()] = model;
        }

        public override string GetFileName()
        {
            return "TableUnionFightCariot.txt";
        }

        protected override TableUnionFightCariot ParseRowData(string[] rowData)
        {
            TableUnionFightCariot data = new TableUnionFightCariot();

            if (string.IsNullOrEmpty(rowData[0]))
            {
                data.UFCId = 0;
            }
            else
            {
                data.UFCId = int.Parse(rowData[0]);
            }

            if (string.IsNullOrEmpty(rowData[1]))
            {
                data.UFFId = 0;
            }
            else
            {
                data.UFFId = int.Parse(rowData[1]);
            }
			data.ModelName = rowData [2];

            if (string.IsNullOrEmpty(rowData[3]))
            {
                data.Range = 0;
            }
            else
            {
                data.Range = double.Parse(rowData[3]);
            }

            if (string.IsNullOrEmpty(rowData[4]))
            {
                data.AttackCountDown = 0;
            }
            else
            {
                data.AttackCountDown = double.Parse(rowData[4]);
            }

            if (string.IsNullOrEmpty(rowData[5]))
            {
                data.AttackDuration = 0;
            }
            else
            {
                data.AttackDuration = double.Parse(rowData[5]);
            }

            if (string.IsNullOrEmpty(rowData[6]))
            {
                data.AttackRelease = 0;
            }
            else
            {
                data.AttackRelease = double.Parse(rowData[6]);
            }
			data.MoveEffect = rowData [7];
			data.HitEffect = rowData [8];
			data.StandEffect = rowData [9];

            return data;
        }


        public override void AddOneIndex(TableUnionFightCariot model)
        {
            if (!cacheOneIndex.ContainsKey(model.UFFId.ToString()))
            {
                cacheOneIndex[model.UFFId.ToString()] = new List<TableUnionFightCariot>();
            }
            cacheOneIndex[model.UFFId.ToString()].Add(model);
        }
    

    }

}
